<!-- Page Content -->
<div class="page-content">
    <!-- Page Breadcrumb -->
    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <a href="/admin">系统</a>
            </li>
            <li>
                <a href="{:url('Article/lst')}">文章管理</a>
            </li>
            <li class="active">修改文章</li>
        </ul>
    </div>
    <!-- /Page Breadcrumb -->

    <!-- Page Body -->
    <div class="page-body">

        <div class="row">
            <div class="col-lg-12 col-sm-12 col-xs-12">
                <div class="widget">
                    <div class="widget-header bordered-bottom bordered-blue">
                        <span class="widget-caption">修改文章</span>
                    </div>
                    <div class="widget-body">
                        <div id="horizontal-form">
                            <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data" >
                                <input type="hidden" name="id" value="{$articles.id}">
                                <div class="form-group">
                                    <label for="title" class="col-sm-2 control-label no-padding-right">标题</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" id="title" value="{$articles.title}" name="title" type="text">
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>

                                <div class="form-group">
                                    <label for="author" class="col-sm-2 control-label no-padding-right">作者</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" id="author" value="{$articles.author}" name="author" type="text">
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>

                                <div class="form-group">
                                    <label for="keywords" class="col-sm-2 control-label no-padding-right">关键词</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" id="keywords" name="keywords" value="{$articles.keywords}" type="text">
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>

                                <div class="form-group">
                                    <label for="desc" class="col-sm-2 control-label no-padding-right">描述</label>
                                    <div class="col-sm-6">
                                        <textarea name="desc" id="desc" class="form-control">{$articles.desc}</textarea>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">缩略图</label>
                                    <div class="col-sm-6">
                                        <input style="float:left;" name="thumb" type="file">
                                        {if condition="$articles['thumb'] neq ''"}
                                        <img style="float:left;" src="{$articles.thumb}" width="30">
                                        {else /}
                                        暂无缩略图
                                        {/if}
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
								<!--是否推荐-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">是否推荐</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['rec'] eq 1"} checked="checked" {/if} name="rec" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['rec'] eq 0"} checked="checked" {/if} class="inverted" name="rec" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                
                                <!--最新资源-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">最新资源</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['new'] eq 1"} checked="checked" {/if} name="new" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['new'] eq 0"} checked="checked" {/if} class="inverted" name="new" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <!--热门资源-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">热门资源</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['hot'] eq 1"} checked="checked" {/if} name="hot" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['hot'] eq 0"} checked="checked" {/if} class="inverted" name="hot" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <!--最新回复-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">最新回复</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['ans'] eq 1"} checked="checked" {/if} name="ans" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['ans'] eq 0"} checked="checked" {/if} class="inverted" name="ans" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <!--最新讨论-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">最新讨论</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['tao'] eq 1"} checked="checked" {/if} name="tao" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['tao'] eq 0"} checked="checked" {/if} class="inverted" name="tao" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <!--资源申请-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">资源申请</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['app'] eq 1"} checked="checked" {/if} name="app" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['app'] eq 0"} checked="checked" {/if} class="inverted" name="app" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <!--最新公告-->
                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">最新公告</label>
                                    <div class="col-sm-6">
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['gao'] eq 1"} checked="checked" {/if} name="gao" value="1" type="radio">
                                            <span class="text">是</span>
                                        </label>
                                        <label style="margin-right:15px;">
                                            <input {if condition="$articles['gao'] eq 0"} checked="checked" {/if} class="inverted" name="gao" value="0" type="radio">
                                            <span class="text">否</span>
                                        </label>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label no-padding-right">所属栏目</label>
                                    <div class="col-sm-6">
                                        <select name="cateid">
                                            {volist name="cateres" id="cate"}
                                            <option {if condition="$cate['id'] eq $articles['cateid']"}selected="selected"{/if} value="{$cate.id}">
                                            {if condition="$cate['level'] neq 0"}|{/if}
                                            <?php echo str_repeat('-', $cate['level']*4)?>{$cate.catename}
                                            </option>
                                            {/volist}
                                        </select>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <div class="form-group">
                                    <label for="content" class="col-sm-2 control-label no-padding-right">内容</label>
                                    <div class="col-sm-6">
                                        <textarea id="content" name="content">{$articles.content}</textarea>
                                    </div>
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <button type="submit" class="btn btn-default">保存信息</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- /Page Body -->
</div>
<!-- /Page Content -->


<!--添加文章的同时指定的关键词被***替代-->
<script type="text/javascript">
    function filter(str) {
        // 多个敏感词，这里直接以数组的形式展示出来
        var arrMg = ["fuck", "tmd","No.1"];
        var newStr = str;
        // 正则表达式
        // \d 匹配数字
        for (var i = 0; i < arrMg.length; i++) {
            // 创建一个正则表达式
            var r = new RegExp(arrMg[i], "ig");
            newStr = newStr.replace(r, "***");
        }
        console.log(newStr);
        return newStr;
    }
    var ue = UE.getEditor('content', {initialFrameWidth: '100%', initialFrameHeight: 400,});

       ue.addListener('blur',function(editor){
           var str = ue.getContent();
      
           ue.setContent(filter(str));
       });
</script>